#include "Configuration.h"
#include <fstream>
#include <iostream>
#include <sstream>
using std::cout;
using std::endl;
using std::ifstream;
using std::istringstream;
Configuration *Configuration::_con = nullptr;
Configuration::Configuration() {
    read();
}
void Configuration::read()
{
    ifstream ifs("/home/zh/3th/finalproject/project/server.conf");
    if (!ifs.is_open())
    {
        cout << "无法打开文件: " << "/home/zh/3th/finalproject/project/server.conf" << endl;
        return;
    }
    string line;
    string key, value;
    while (getline(ifs, line))
    {
        istringstream iss(line);
        iss >> key >> value;
        _map[key] = value;
    }
    ifs.close();
}
map<string,string> & Configuration::get()
{
    return _map;
}
